﻿namespace PhotobucketNet
{
    using System.Collections.Generic;
    using System.Xml;

    public class UserContactList : List<UserContact>
    {
        internal static UserContactList CreateFromXmlDocument(XmlDocument document)
        {
            return CreateFromXmlNodeList(document.SelectNodes("descendant::contact"));
        }

        internal static UserContactList CreateFromXmlNodeList(XmlNodeList contactNodes)
        {
            UserContactList list = new UserContactList();
            foreach (XmlNode node in contactNodes)
            {
                list.Add(UserContact.CreateFromXmlNode(node));
            }
            return list;
        }

        internal static UserContactList CreateFromXmlResponseMessage(XmlResponseMessage responseMessage)
        {
            return CreateFromXmlDocument(responseMessage.ResponseXml);
        }
    }
}

